package io.xccit.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.xccit.pojo.collect.Collect;
import io.xccit.result.AjaxResult;
import io.xccit.service.ICollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author CH_ywx
 * @date 2023-09-14
 * @description
 */
@Api(tags = "收藏接口")
@RestController
@RequestMapping("/collect")
public class CollectController {

    @Autowired
    private ICollectService collectService;

    @ApiOperation("添加收藏")
    @PostMapping("/save")
    public AjaxResult save(@RequestBody Collect collect){
        return collectService.saveCollect(collect);
    }

    @ApiModelProperty("获取收藏")
    @PostMapping("/list")
    public AjaxResult list(@RequestBody Collect collect){
        return collectService.getCollectList(collect.getUserId());
    }

    @ApiOperation("删除收藏")
    @PostMapping("/remove")
    public AjaxResult remove(@RequestBody Collect collect){

        return collectService.removeCollect(collect);
    }
}
